Guest User

Untitled

a guest
Oct 20th, 2011
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<math.h>
  4.  
  5. int main()
  6. {
  7.       int a,b,c,delta,x1,x2,x0;
  8.  
  9.       printf("Poda a: ");
  10.       scanf("%d",&a);
  11.       printf("Poda b: ");
  12.       scanf("%d",&b);
  13.       printf("Poda c: ");
  14.       scanf("%d",&c);
  15.       delta=(b*b)-4*a*c;
  16.      
  17.       if(delta<0) printf("Brak rozwiazan\n");
  18.       if(delta==0){  
  19.          x0=(-b-sqrt(delta))/(2*a);        
  20.          printf("x0=%.2f\n",x0);
  21.       }
  22.      
  23.       if(delta>0)
  24.       {
  25.          x1=(-b-sqrt(delta))/(2*a);
  26.          x2=(-b+sqrt(delta))/(2*a);
  27.          printf("x1=%.2f\n x2=%.2f\n",x1,x2);
  28.       }
  29.       system("PAUSE");
  30.       return 0;
  31. }
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment